class Zcsh {
    public int countNumbersWithUniqueDigits(int n) {
        if (n == 0) return 1;
        int result = 10;

        for (int i = 2; i <= n; i++) {
            int count = 1;
            for(int j = 1; j <= i; j++) {
                count *= j >= 3 ? 11 - j : 9;
            }
            result += count;
        }

        return result;
    }

}